package ${{info.packageBase}}.${{info.packageControl}}.${{info.controlPackage}};

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.virens.common.RequestUtil;

import ${{info.packageBase}}.web.common.BaseTableController;
import ${{info.packageBase}}.${{info.packageModel}}.${{info.modelPackage}}.${{info.modelName}};
import ${{info.packageBase}}.${{info.packageService}}.${{info.modelPackage}}.${{info.modelName}}Service;

/**
 * ${{info.name}} - ${{info.modelTable}}
 *
 * @author Virens
 * @since ${{info.date}}
 */
@Controller
@RequestMapping("/manage/${{info.controlMapping}}")
public class ${{info.controlName}}Contorller extends BaseTableController<${{info.modelName}}, ${{info.modelName}}Service> {

	public ${{info.controlName}}Contorller() {
		super("/manage/${{info.controlMapping}}", "${{info.controlIdentity}}");
	}
	
	@RequestMapping("view.jspx")
	public String viewJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("record", mBaseService.selectOne(RequestUtil.getValueInt(request, "id")));

		return returnUrl("view");
	}
	
	@RequestMapping("create.jspx")
	public String createJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		return returnUrl("create");
	}

	@RequestMapping("update.jspx")
	public String updateJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("record", mBaseService.selectOne(RequestUtil.getValueInt(request, "id")));

		return returnUrl("update");
	}
	
}
